<template>
  <div class="yz-condition-filter">
    <div class="form-inline justify-between form-inline bottom" :class="{'padding-t-10': hasMT}">
      <div class="left box flex">
          <slot></slot>
      </div>
<!--          按钮-->
      <div class="flex no-wrap">
        <q-btn class="btn margin-r-10"
               outline
               color="primary"
               v-if="!hideReset"
               @click="resetSearch"
               label="重置" />
        <q-btn class="btn"
               unelevated
               type="submit"
               v-throttle
               color="primary"
               label="查询"
               @click="onSubmit" />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'yz-condition-filter',
  props: {
    hasMT: {
      type: Boolean,
      default: false
    },
    hideReset: {
      type: Boolean,
      default: false
    },
    value: [Object]
  },
  data () {
    return {
      queryParams: {}
    }
  },
  watch: {
    value: {
      handler (val) {
        this.queryParams = val
      },
      deep: true,
      immediate: true
    },
    queryParams: {
      deep: true,
      handler () {
        this.$emit('input', this.queryParams)
      }
    }
  },
  computed: {
  },
  methods: {
    resetSearch () {
      this.$emit('resetSearch', this.queryParams)
    },
    onSubmit () {
      this.$emit('onSubmit', this.queryParams)
    }
  },
  mounted () {

  }
}
</script>

<style scoped lang="stylus">
  .padding-t-10{
    padding-top 10px !important
  }
  .bottom{
    padding-bottom 0
  }
</style>
